package com.hangzhou.xyj.net.request;

import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.hangzhou.xyj.XYJApplication;
import com.hangzhou.xyj.net.request.base.BaseRequest;
import com.hangzhou.xyj.utils.PublicUtil;
import com.hangzhou.xyj.utils.constants.API;

/**
 * Created by yaohuix on 2016/2/24  14:36
 * <p/>
 * 说明：我-收藏 请求
 */
public class CollectReq extends BaseRequest {
    /**
     * @param collectId 被收藏的对象的Id
     * @return
     * @Description
     * @author yaohuix
     * @date 2016/2/24 14:37
     */
    public CollectReq(String collectId) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("collectId", PublicUtil.string2Long(collectId));
        if (XYJApplication.getInstance().getUserInfo() != null) {
            jsonObject.addProperty("userId", PublicUtil.string2Long(XYJApplication.getInstance().getUserInfo().getUserId()));
        }
        String jsonStr = new Gson().toJson(jsonObject);
        add("data", jsonStr);
    }

    @Override
    public String getUrl() {
        return API.MY_COLLECT;
    }
}
